package com.example.smart.ui.m

import com.example.lib.extend.setOnDoubleClickListener
import com.example.lib.utils.sp.SpKey
import com.example.lib.utils.sp.SpUtils
import com.example.lib.utils.statusbar.StatusBarUtils
import com.example.smart.R
import com.example.smart.base.ui.activity.BaseActivity
import com.example.smart.databinding.ActivityLoginChooseMBinding
import com.example.smart.dialog.WelcomeScanSuccessDialog
import com.example.smart.utils.DisplayUtils
import java.util.Timer
import kotlin.concurrent.timerTask

class MLoginChooseActivity : BaseActivity<ActivityLoginChooseMBinding>() {

    private val mDialog by lazy {
        WelcomeScanSuccessDialog(this@MLoginChooseActivity)
    }

    override fun layoutID() = R.layout.activity_login_choose_m

    override fun initView() {
        StatusBarUtils.setStateAndNavigationBar(this@MLoginChooseActivity,
            statusBarColor = com.example.lib.R.color.translate)
    }

    override fun initListener() {

        binding.Rel1.setOnDoubleClickListener {
            finish()
        }

        binding.Start.setOnDoubleClickListener {
            showLoading("")
            SpUtils.putBoolean(SpKey.IS_LOGIN, true)
            Timer().schedule(timerTask {
                runOnUiThread {
                    hideLoading()
                    mDialog.show()
                }
            }, 2000)
        }

        binding.AccountLogin.setOnDoubleClickListener {
            DisplayUtils.toAccountLogin(this@MLoginChooseActivity, isNeedFinish = false)
        }
    }
}